package com.cn.book.config;

import com.ecwid.consul.v1.ConsulClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.consul.discovery.ConsulDiscoveryProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;

@Configuration
public class MyConsulDiscoveryClientConfig {

    @Autowired
    private ConsulClient client;
    @Autowired
    private ConsulDiscoveryProperties properties;

    @Bean
    @Order(Ordered.HIGHEST_PRECEDENCE)
    public MyConsulDiscoveryClient myConsulDiscoveryClient() {
        return new MyConsulDiscoveryClient(client, properties);
    }
}
